﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using Workflow.Domain.Models;

namespace Workflow.Infrastructure.IRepository
{
    public interface IBaseRepository<T> where T : BaseEntity
    {
        /// <summary>
        /// 表达式单条件查询
        /// </summary>
        /// <param name="exp"></param>
        /// <returns></returns>
        Task<T> GetValue(Expression<Func<T,bool>>exp);
        /// <summary>
        /// 列表
        /// </summary>
        /// <returns></returns>
        IQueryable<T> GetAll();
        /// <summary>
        /// 根据id查询数据
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>

        Task<T?> GetModel(long id);
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="arr"></param>
        /// <returns></returns>

        // params:可变数组
        Task<int> AddRange(params T[] arr);
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="arr"></param>
        /// <returns></returns>

        Task<int> UpdateRange(params T[] arr);
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>

        Task<int> Delete(params long[] id);
    }
}
